package com.hejjon.core.enumer;

public enum ResultCodeEnum {

    /**
     * 请求成功
     */
    SUCCESS(200, "success"),

    /**
     * 没有权限
     */
    HAVE_NO_PERMISSION(403, "You don't have permission to access this website!"),

    /**
     * 可以申请权限
     */
    NEEDED_APPLICATION_PERMISSION(402, "需要申请权限!"),

    ACCOUNT_ERROR(401, "账号错误！"),
    PASSWORD_ERROR(401, "密码错误！"),

    USERNAME_OR_PASSWORD_ERROR(401, "用户名或密码错误!"),

    TOKEN_ERROR(401, "无效的token！"),
    ACCOUNT_LOCK_ERROR(403, "对不起，账号已被锁定,请和管理员联系！"),
    PASSWORD_EXPIRE_ERROR(403, "该账号密码已失效,请和管理员联系！"),


    /**
     * 自定义异常
     */
    Native(302,"Custom Exception"),

    NOT_LOGIN(-1010,"账号未登录"),

    /**
     * 服务器内部错误
     */
    INTERNAL_SERVER_ERROR(500,"服务器内部异常"),
    DUPLICATION_COMMIT(418,"重复提交"),
    /**
     * 主键参数校验异常
     */
    NO_ID_FOUND(500,"主键参数校验异常"),

    /**
     * 参数传入异常
     */
    NO_PARAMETER_FOUND(400,"参数传入异常"),


    /**
     * 用户操作失败
     */
    OPERATOR_ERROR(500, "操作失败");

    /**
     * 编码
     */
    private int ret;
    /**
     * 信息
     */
    private String msg;

    ResultCodeEnum(Integer ret, String msg) {
        this.ret = ret;
        this.msg = msg;
    }

    public int getRet() {
        return ret;
    }

    public void setRet(int ret) {
        this.ret = ret;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return ret + " : " + msg;
    }
    }
